package com.njtoyo.taxi.admin.rest.export;


import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;


/**
 * 布尔型字段转换导出
 */
public class BooleanToChineseConverter implements Converter<Boolean> {
    @Override
    public Class<Boolean> supportJavaTypeKey() { return Boolean.class; }

    @Override
    public WriteCellData<?> convertToExcelData(Boolean value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
        String chineseValue = value ? "是" : "否";
        return new WriteCellData<>(chineseValue);
    }
}
